home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 7881 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.5 KB

  1. Path: news.lpr.carel.fi!usenet
  2. From: Ari Lukumies <aril@cmt.lpr.mail.carel.fi>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: C programer dosn't understand windows 3.1
  5. Date: Thu, 29 Feb 1996 16:45:19 +0200
  6. Organization: Carelcomp Forest
  7. Message-ID: <3135BBFF.7D97@cmt.lpr.mail.carel.fi>
  8. References: <4h44v8$i3m@pipe12.nyc.pipeline.com>
  9. NNTP-Posting-Host: renoir.cclahti.carel.fi
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0 (WinNT; I)
  14.  
  15. John Dillworth wrote:
  16. > I need to insert a blank line between each printed line of text in this
  17. > Windows program fragment:
  18. >                for (i = nPaintBeg ; i < nPaintEnd ; i++)
  19. >                     {
  20. >                     x = cxChar * (1 - nHscrollPos) ;
  21. >                     y = cyChar * (1 - nVscrollPos + i) ;
  22. >                     TextOut (hdc, x, y,
  23. >                              sysmetrics[i].szLabel,
  24. >                              lstrlen (sysmetrics[i].szLabel)) ;
  25. >                     TextOut (hdc, x + 22 * cxCaps, y,
  26. >                              sysmetrics[i].szDesc,
  27. >                              lstrlen (sysmetrics[i].szDesc)) ;
  28. >                              TextOut (hdc, x, y,
  29. >                              sysmetrics[i].szLabel,
  30. >                              lstrlen (sysmetrics[i].szLabel)) ;
  31. >                     TextOut (hdc, x + 22 * cxCaps, y,
  32. >                              sysmetrics[i].szDesc,
  33. >                              lstrlen (sysmetrics[i].szDesc)) ;
  34. >                     SetTextAlign (hdc, TA_RIGHT | TA_TOP) ;
  35. >                     TextOut (hdc, x + 22 * cxCaps + 40 * cxChar, y,
  36. >                              szBuffer,
  37. >                              wsprintf (szBuffer, "%5d",
  38. >                                   GetSystemMetrics (sysmetrics[i].nIndex))) ;
  39. >                     SetTextAlign (hdc, TA_LEFT | TA_TOP) ;
  40. >                //     wsprintf (szBuffer, "/n/a"  );
  41. >                     }
  42. > Now in C I plain old ANSI C I would just put a couple of printf's with
  43. > newline characters.  This dosn't work with windows (this is c huh??  ;-) ).
  44. >  How do I insert blank line between each line of text in this program?
  45. > Thanks in advance
  46.  
  47. Track the number of "text line" when you print a line; then, increase it by two instead 
  48. of just one and calculate the y offset for the next line multiplying by that number. 
  49. (BTW, in your wsprintf, "/n/a" should read "\n\a", FWIF).
  50.  
  51. Later,
  52.  AriL
  53. -- 
  54. All my opinions are mine and mine alone.
  55.